import { http } from '@/http/http'

interface IGetHomeWallApiOptions {
  [key: string]: any
}
interface IClassifyOPtions {
  pageNum?: number
  pageSize?: number
  select?: boolean
}
interface IGetWallNewsListRequest {
  select?: boolean
  pageNum?: number
  pageSize?: number
}
interface IWallListRequest {
  classid: string
  pageNum?: number
  pageSize?: number
}
interface IUserWallList {
  type: string
  page?: number
  pageSize?: number
}
interface ISetupScore {
  classid: string
  wallId: string
  userScore: string
}
interface IDownloadWall {
  classid: string
  wallId: string
}
interface ISearchWall {
  keyword: string
  pageNum?: number
  pageSize: number
}
// 添加壁纸的key  options.header['access-key'] = 1023086107
/** GET 请求；支持 传递 header 的范例 */

export function getHomeBannerApi() {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/homeBanner')
}
export function getRandomWallApi() {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/randomWall')
}
export function getClassifyApi(data: IClassifyOPtions) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/classify', data)
}
// 公告详情
export function getWallNewsDetailApi() {
  return http.get<IGetHomeWallApiOptions>('/api/bizhi/wallNewsDetail', { id: '653507c6466d417a3718e94b' })
}
// 公告列表
export function getWallNewsListApi(data: IGetWallNewsListRequest = { select: true, pageNum: 1, pageSize: 10 }) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/wallNewsList')
}
// 壁纸分类列表
export function getWallListApi(data: IWallListRequest) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/wallList', data)
}
// 单个壁纸详情
export function getDetailWallApi(id: string) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/detailWall', { id })
}
// 我的评分/下载
export function getUserWallListApi(data: IUserWallList) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/userWallList', data)
}
// 为壁纸评分
export function getSetupScoreApi(data: ISetupScore) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/setupScore', data)
}
// 壁纸下载,防止多次下载
export function getDownloadWallApi(data: IDownloadWall) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/downloadWall', data)
}
// 用户个人信息
export function getUserInfoApi() {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/userInfo')
}
// 搜索
export function getSearchWallApi(data: ISearchWall) {
  return http.get<Array<IGetHomeWallApiOptions>>('/api/bizhi/searchWall', data)
}
// ----------------
// 添加壁纸的key  options.header['access-key'] = 1023086107
/** GET 请求；支持 传递 header 的范例 */
interface IGetPetShowApiOptions {
  size?: number
  type?: string
}
export function getPetShowApi(data: IGetPetShowApiOptions) {
  return http.get<Array<IGetPetShowApiOptions>>('/tools/petShow', data)
}
